package com.nuanshui.heatedloan.extension.filter;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.core.filter.Filter;
import ch.qos.logback.core.spi.FilterReply;

public class LogBackErrorFilter  extends Filter<Object>{

	@Override
	public FilterReply decide(Object event) {
		LoggingEvent e = (LoggingEvent)event; 
		if(e.getLevel().toInt()<Level.ERROR_INT) return FilterReply.DENY;
		if(e.getLevel().toInt()>=Level.ERROR_INT) {
			String  classname = e.getThrowableProxy().getClassName();
			if(classname.startsWith("com.muying.service") || classname.startsWith("com.muying.framework")) {
				return FilterReply.DENY;
			}
		}
		return FilterReply.ACCEPT;
	}

}
